#include <iostream>

int main(int argc, char const *argv[])
{
    
    using namespace std;

    string str = string();

    str = "hello world";
    cout << str << endl;

    str = 'A';
    cout << str << endl;

    const char *arr = "hello char* arr";
    str = arr;
    cout << str << endl;

    str.assign("如果你在就好了");
    cout << str << endl;

    str.assign(8, 'A');
    cout << str << endl;

    str.assign(arr);
    cout << str << endl;

    str.assign(str, 1, 5);
    cout << str << endl;

    str.assign(str, 1); // 字符串，去掉前面1个，剩余后面的，相当于str.assign(str, start, len); 其中len是字符串的长度
    cout << str << endl;

    str.assign(arr, 3); // 字符数组，取得前面3个，剩余的丢掉
    cout << str << endl;

    return 0;
}
